package com.qth.valet.common.theadlocal;

public class UserOrDriverIdHolder {

    /**
     * 饿汉
     */
    private static final ThreadLocal<Integer> driverId = new ThreadLocal<>();
    private static final ThreadLocal<Integer> userId = new ThreadLocal<>();

    public static void setDriverId(Integer id) {
        driverId.set(id);
    }
    public static void setUserId(Integer id) {
        userId.set(id);
    }

    public static Integer getDriverId() {
        return driverId.get();
    }
    public static Integer getUserId() {
        return userId.get();
    }

    public static void clear() {
        userId.remove();
        driverId.remove();
    }

}
